<!--   添加活动 -->
<template>
	<view class="special-group">
		<view class="go-home" @click="backHome">
			<image :src="imglink + 'home/home-Selected.png'" mode=""></image>
		</view>
		<!-- 团购活动课程轮播图 -->
		<view class="special-group-swiper">
			 <view class="" v-if="list.image.length != 0">
			 	<swiper 
					class="swiper" 
					:indicator-dots="indicatorDots" 
					:autoplay="autoplay" 
					:interval="interval" 
					:duration="duration" 
					v-if="list.image.length != 0"
				>
			 		<swiper-item class="discounts-page" v-for="(item,index) in list.image" :key='index'>
			 			<image :src="item" mode="scaleToFill" style="width: 100%;"></image>
						<view class="" v-if="index == 0">
							封面
						</view>
			 		</swiper-item>
			 	</swiper>
			 </view>
			 <view class="choose-img">
			 	<view class="choose-swiper-img">
			 		请选择封面轮播图（最少1张，最多4张，第1张是封面）
			 	</view>
				<view class="choose-img-details">
					<view class="choose-img-common" @click="upLoadImg('0')" v-if="list.image.length == 0">
						<image class="updata-img" :src="imglink + 'member/manage_icon_camera.png'" mode=""></image>
						<view class="upload-img">
							+上传图片
						</view>
						<view class="img-num">
							1
						</view>
					</view>
					<view class="choose-img-common" v-else>
						<image class="choose-img-detail" :src="list.image[0]" mode="" style="width: 100%;height: 100%;margin: 0;"></image>
						<view class="masking"></view>
						<view class="img-num">1</view>
						<view class="updata" @click="replaceClcik(0)">
							更换照片
						</view>
						<image class="delete-upload-imf" :src="imglink + 'member/manage-active_icon_delete.png'" mode=""  @click="delSwiper('0')"></image>
					</view>
					<view class="choose-img-common" @click="upLoadImg('1')" v-if="list.image.length <=1">
						<image class="updata-img" :src="imglink + 'member/manage_icon_camera.png'" mode=""></image>
						<view class="upload-img">
							+上传图片
						</view>
						<view class="img-num">
							2
						</view>
					</view>
					<view class="choose-img-common" v-else>
						<image class="choose-img-detail" :src="list.image[1]" mode="" style="width: 100%;height: 100%;margin: 0;"></image>
						<view class="masking"></view>
						<view class="img-num">
							2
						</view>
						<view class="updata" @click="replaceClcik(1)">
							更换照片
						</view>
						<image class="delete-upload-imf" :src="imglink + 'member/manage-active_icon_delete.png'" mode="" @click="delSwiper('1')"></image>
					</view>
					<view class="choose-img-common"  @click="upLoadImg('2')" v-if="list.image.length <=2">
						<image class="updata-img" :src="imglink + 'member/manage_icon_camera.png'" mode=""></image>
						<view class="upload-img">
							+上传图片
						</view>
						<view class="img-num">
							3
						</view>
					</view>
					<view class="choose-img-common" v-else>
						<image class="choose-img-detail" :src="list.image[2]" mode="" style="width: 100%;height: 100%;margin: 0;"></image>
						<view class="masking"></view>
						<view class="img-num">
							3
						</view>
						<view class="updata" @click="replaceClcik(2)">
							更换照片
						</view>
						<image class="delete-upload-imf" :src="imglink + 'member/manage-active_icon_delete.png'" mode=""  @click="delSwiper('2')"></image>
					</view>
					<view class="choose-img-common"  @click="upLoadImg('3')" v-if="list.image.length <=3">
						<image class="updata-img" :src="imglink + 'member/manage_icon_camera.png'" mode=""></image>
						<view class="upload-img">
							+上传图片
						</view>
						<view class="img-num">
							4
						</view>
					</view>
					<view class="choose-img-common" v-else>
						<image class="choose-img-detail" :src="list.image[3]" mode="" style="width: 100%;height: 100%;margin: 0;"></image>
						<view class="masking"></view>
						<view class="img-num">
							4
						</view>
						<view class="updata" @click="replaceClcik(3)">
							更换照片
						</view>
						<image class="delete-upload-imf" :src="imglink + 'member/manage-active_icon_delete.png'" mode="" @click="delSwiper('3')"></image>
					</view>
				</view>
			 </view>
		</view>
		<!-- 活动标题与时间设置 -->
		<view class="act-time-title">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					活动标题
				</view>
			</view>
			<view class="act-title-tip">
				<textarea v-model="list.name" placeholder="活动标题最多50个字" maxlength='50' @input="actTitleInput" />
				<view class="">{{data.titleNum}}/50</view>
			</view>
			<view class="explain-title" style="margin-top: 40upx;">
				<view class=""></view>
				<view class="">
					活动时间设置
				</view>
			</view>
			<view class="act-time-set">
				<view class="">
					开始时间
				</view>
				<view class="start-data">
					<picker mode="date" :value="list.startDate" @change="dateStartChange">
					    <view>{{list.startDate}}</view>
					</picker>
				</view>
				<view class="start-time">
					<picker mode="time" :value="list.startTime" @change="timeStartChange">
					    <view>{{list.startTime}}</view>
					</picker>
				</view>
			</view>
			<view class="act-time-set">
				<view class="">
					结束时间
				</view>
				<view class="start-data">
					<picker mode="date" :value="list.endDate" @change="dateEndChange">
					    <view>{{list.endDate}}</view>
					</picker>
				</view>
				<view class="start-time">
					<picker mode="time" :value="list.endTime" @change="timeEndChange">
					    <view>{{list.endTime}}</view>
					</picker>
				</view>
			</view>
		</view>
		<!-- 活动课程设置 -->
		<view class="act-course-set">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					活动课程设置
				</view>
			</view>
			<view class="act-title">
				<view class="">
					活动科目名额设定
				</view>
				<input type="number" v-model="list.allowed_total" placeholder="请输入活动科目总名额" />
			</view>
			<view class="add-num">
				<view class="">
					<text>剩余20%自动增加名额(每次增加20个）</text>
					<switch :checked="data.addNum" @change="switch1ChangeNum" color="#FF8B46"/>
				</view>
				<view class="">
					开启后,活动名额低于20%时，系统将自动增加20个名额
				</view>
			</view>
			<view class="virtual-join">
				<view class="">
					<view class="">
						默认虚拟报名科目数
					</view>
					<input type="number" v-model="list.virtual_total" placeholder="请输入虚拟的报名科目数"/>
				</view>
				<view class="">
					激发用户从众心理，报名人数=默认虚拟报名科目+实际报名数
				</view>
			</view>
			<view class="buy-course-count">
				<view class="buy-course-count-set">
					<view class="">
						<text>每人限购课程数量</text>
						<switch :checked='data.isLimit' @change="switch1ChangeLimit" color="#FF8B46"/>
					</view>
					<view class="buy-course-amount">
						<image :src="imglink + 'home/reduce_black.png'" mode="" @click="reduceCourseNum('1')"></image>
						<view class="">{{list.allowed_purchase_quantity}}</view>
						<image :src="imglink + 'home/add-colours.png'" mode="" @click="addCourseNum('1')"></image>
					</view>
				</view>
				<view class="">
					开启限购数量，每个用户活动报名科目数不能超过设定数量
				</view>
			</view>
		</view>
		<!-- 买课赠课福利设置 -->
		<view class="give-course-coupon">
			<view class="act_explain-title">
				<view class="explain-title" style="margin-top: 12upx;">
					<view class=""></view>
					<view class="">
						买课赠课福利设置
					</view>
				</view>
				<view class="explain_tip">
					<switch :checked='data.isGiveCourse' @change="switch1ChangeCourse" color="#FF8B46"/>
				</view>
			</view>
			<view class="give-course-tip">
				开启后，家长本活动买满几课程，可以免费送几课程，谨慎操作
			</view>
			<view class="buy-give-course">
				例：买<text>3</text>个课程送<text>1</text>个课程
			</view>
			<view class="buy-give-course-num">
				<view class="buy-give-course-details">
					<text>买</text>
					<view class="">
						<image :src="imglink + 'home/reduce_black.png'" mode="" @click="reduceCourseNum('2')"></image>
						<view class="">{{list.purchase_course}}</view>
						<image :src="imglink + 'home/add-colours.png'" mode="" @click="addCourseNum('2')"></image>
					</view>
					<text>课</text>
				</view>
				<view class="buy-give-course-details" style="margin-left: 100upx;">
					<text>送</text>
					<view class="">
						<image :src="imglink + 'home/reduce_black.png'" mode="" @click="reduceCourseNum('3')"></image>
						<view class="">{{list.give_course}}</view>
						<image :src="imglink + 'home/add-colours.png'" mode="" @click="addCourseNum('3')"></image>
					</view>
					<text>课</text>
				</view>
			</view>
		</view>
		<!-- 拼团设置 -->
		<view class="group-set" v-if="page_type == 'group'">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					拼团设置
				</view>
			</view>
			<view class="clustering-num">
				<view class="">成团人数</view>
				<input type="number" v-model="list.quanlity_group_purchase" placeholder="请输入成团人数，最少2人"/>
			</view>
			<view class="is-open-group">
				<view class="is-open-group-content">
					<view class="is-open-group-choose">
						<text>是否开启虚拟成团</text>
						 <switch :checked='data.VirtualGroup' @change="switch1ChangeGroup" color="#FF8B46"/>
					</view>
					<view class="is-open-group-time" v-if="data.VirtualGroup">
						<view class="is-open-group-hour">
							 <radio-group style="display: block;" @change="radioChange">
								<label style="display: flex;" class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
									<view>
										<radio color="#FF8B46" :value="item.value" :checked="index === current" />
									</view>
									<!-- <view>{{item.name}}<text v-if="item.num">{{item.num}}</text>{{item.addName}}</view> -->
									<view class="" style="display: flex;">
										<text>{{item.name}}</text>
										<input type="number" v-model="list.end_group_purchase_hour" v-if="index == 0"/>
										<text>{{item.addName}}</text>
									</view>
								</label>
							</radio-group>
						</view>
					</view>
				</view>
				<view class="is-open-group-tip">
					开启虚拟成团后，当用户拼团不成功时，自动成团谨慎操作
				</view>
			</view>
			<view class="group-defeated">
				<view class="group-defeated-title">
					拼团失败是否退款
				</view>
				<view class="group-defeated-details">
					<view class="group-defeated-content">
						<!-- <image :src="imglink + 'member/manage-active_icon_normal2.png'" mode=""></image>
						<view class="">不退款，线下协商退款</view> -->
						<radio-group @change="radioChangeRefund">
							<label style="display: flex;" class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in refundList" :key="index + '1'">
								<view>
									<radio color="#FF8B46" :value="item.value" :checked="index === currentRefund" />
								</view>
								<view>{{item.name}}</view>
							</label>
						</radio-group>
					</view>
					<!-- <view class="group-defeated-content">
						<image :src="imglink + 'member/manage-active_icon_normal1.png'" mode=""></image>
						<view class="">系统自动退款给用户</view>
					</view> -->
				</view>
			</view>
			<view class="header-welfare">
				<view class="header-welfare-title">
					<text>团长福利</text>
					<switch :checked='data.isWelfare' @change="switch1ChangeWelfare" color="#FF8B46"/>
				</view>
				<view class="header-welfare-input"  v-if="data.isWelfare">
					<textarea v-model="list.head_welfare_content" placeholder="请输入团长福利内容" />
				</view>
			</view>
			<view class="is-show-other-group">
				<view class="is-show-other-group-title">
					<text>报名页面是否显示“参与他人的团”</text>
					<switch :checked='data.showOther' @change="switch1ChangeShow" color="#FF8B46"/>
				</view>
				<view class="is-show-other-group-tip">
					开启后，在拼团报名页面，可以用户可以直接点“参与他人团”,享受成团价；不开启，用户只能通过参团链接，来参与拼团。
				</view>
			</view>
		</view>
		<!-- 参与活动课程 -->
		<view class="join-act-course">
			<view class="course_type-title" id="courseTitle">
				<view class="">
					参与活动课程
				</view>
			</view>
			<view id="actCourse" class="join-act-course-details" v-if="list.course_msg.length > 0" v-for="(item,index) in list.course_msg" :key='index'>
				<image :src="imglink + 'member/manage-active_icon_delete.png'" mode="" style="left: -20upx;" @click="delAct(index)"></image>
				<image :src="imglink + 'member/rank.png'" @click="rankCourse(index,item)" mode="" style="right: -20upx;"></image>
				<view class="explain-title">
					<view class=""></view>
					<view class="">
						课程{{index+1}}
					</view>
				</view>
				<view class="join-course-title">
					<view class="join-course-title-img" @click="changeImg(item,index)" v-if="item.image != ''">
						<image :src="item.image" mode=""></image>
						<view class="masking"></view>
						<view class="change-photo">更换照片</view>
					</view>
					<view class="no-img" v-else @click="upImg(item,index)">
						<image class="" :src="imglink + 'member/manage_icon_camera.png'" mode=""></image>
						<view class="">
							+上传图片
						</view>
					</view>
					<view class="join-course-title-input">
						<textarea v-model="item.name" placeholder="请输入课程标题" maxlength="30" @input="courseTitle($event,item,index)"/>
						<view class="">{{item.actTitleNum}}/30</view>
					</view>
				</view>
				<view class="commodity-original-price">
					<view class="">
						商品原价(元)
					</view>
					<input type="number" v-model="item.origin_price" placeholder="请输入商品原价"/>
				</view>
				<view class="alone-buy-discounts">
					<view class="">
						单独购买优惠价(元)
					</view>
					<input type="number" v-model="item.special_price" placeholder="请输入商品优惠价"/>
				</view>
				<view class="join-group-price" v-if="page_type == 'group'">
					<view class="join-group-price-content">
						<view class="">
							参团价格(元)
						</view>
						<input type="number" v-model="item.group_purchase_price" placeholder="请输入商品参团价"/>
					</view>
				</view>
				<view class="join-group-price-tip">
					不能低于1元，有人报名后不可修改
				</view>
				<view class="restricted-purchase">
					<view class="restricted-purchase-content">
						<view class="restricted-purchase-content-open">
							<text>每人限购课程数量</text>
							<switch :checked='item.isOpenNum' @change="switch1ChangeCourseNum($event,item)" color="#FF8B46"/>
						</view>
						<view class="restricted-purchase-content-num">
							<image :src="imglink + 'home/reduce_black.png'" mode="" @click="reduceCourseNum('4',item)"></image>
							<view class="">{{item.limit_course}}</view>
							<image :src="imglink + 'home/add-colours.png'" mode="" @click="addCourseNum('4',item)"></image>
						</view>
					</view>
					<view class="restricted-purchase-tip">
						开启限购数量，每个人不可超过限购数量
					</view>
				</view>
				<view class="give-shopping-card">
					<view class="give-shopping-card-content">
						<text>给家长赠送现金购物卡</text>
						<switch :checked='item.isGive' @change="switch1ChangeGive($event,item,index)" color="#FF8B46"/>
					</view>
					<view class="give-shopping-card-tip">
						开启限购数量，每个人不可超过限购数量
					</view>
				</view>
				<view class="give-shopping-card-money">
					<view class="">
						赠送购物卡面值金额
					</view>
					<input type="number" :disabled="!item.isGive" v-model="item.cash_shopping_card_amount" placeholder="最少100，需要100整倍数" @blur="shoppingCardPrice($event,item,index)"/>
				</view>
				<view class="give-shopping-card-details">
					<view class="">
						扣除购物卡渠道成本价：<text>¥{{item.cardCostPrice || 0}}.00</text>
					</view>
					<view class="">
						说明：家长下单购买后才会赠送购物卡，最低100元，需要是100的整数倍。根据购物卡面值，自动计算购物的渠道成本价，从家长报名费中扣除；购物激活后，不可线上退款；赠送购物卡成本价不能超过课程最低价格；赠送的课程，不送现金购物卡；
					</view>
				</view>
				<view class="act-address">
					<view class="act-address-title" style="width: 23%;">
						活动门店
					</view>
					<view class="act-address-choose" @click="chooseShop(index,item)">
						<text>请选择参与门店</text>
						<image :src="imglink + 'home/arrow-right.png'" mode=""></image>
					</view>
				</view>
				<view class="shop-name">
					<view class="" v-for="(name,num) in item.shopName" :key='num'>
						<view class="">{{name}}</view>
						<image :src="imglink + 'member/management_icon_textdelete.png'" mode="" @click="delShop(num,item)"></image>
					</view>
				</view>
				<view class="subject-details">
					<view class="subject-details-title" @click="showDetail(item,index)">
						<text>课程详情</text>
						<text>（选填）</text>
						<image :src="imglink + 'member/check-details.png'" mode=""></image>
					</view>
					<view class="text-img-content" v-if="item.showDetails">
						<view class="text-img-details" >
							<view class="" v-for="(src,i) in item.activity_course_description" :key='i'>
								<view class="img-details" v-if="item.activity_course_description.length > 0 && ( src.type == 'photo' || src.image!=null)">
									<image class="img-content" :src="src.value || src.image" mode=""></image>
									<view class="masking"></view>
									<image class="delete-img" :src="imglink + 'member/manage-active_icon_delete.png'" mode="" @click="delCourseImg(i,item.activity_course_description)"></image>
									<image class="rank-img" :src="imglink + 'member/rank.png'" mode="" @click="rankcourseDetail(i,src,item)"></image>
									<view class="change-img" @click="changeDetailImg(src,index,i)">
										更换图片
									</view>
								</view>
								<view class="text-details" v-if="item.activity_course_description.length > 0 && (src.type == 'text' || src.text!= null)">
									<textarea :value="src.value || src.text" placeholder="请输入文字介绍" @input="gainValue($event,src)"/>
									<image class="delete-img" @click="delText(i,item.activity_course_description)" src="member/manage-active_icon_delete.png" mode=""></image>
									<image class="rank-img" :src="imglink + 'member/rank.png'" mode="" @click="rankcourseDetail(i,src,item)"></image>
								</view>
							</view>
							<view class="add-img-text">
								<view class="add-details" @click="addImg(item,index)">
									<image :src="imglink + 'member/add-img.png'" mode=""></image>
									<text>添加图片</text>
								</view>
								<view class="add-details" @click="addText(item,index)">
									<image :src="imglink + 'member/add-text.png'" mode=""></image>
									<text>添加文字</text>
								</view>
							</view>
						</view>
						<view class="pack-up-details" @click="packUpDetail(item,index)">
							<text>收起详情</text>
							<image :src="imglink + 'member/member-right-two.png'" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			<view class="add-course" @click="addCourse">
				+添加新课程
			</view>
		</view>
		<!-- 报名信息收集表单 -->
		<view class="apply-msg">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					报名信息收集表单
				</view>
			</view>
			<view class="apply-msg-contain">
				<view class="apply-msg-all">
					收集信息
				</view>
				<view class="apply-msg-content">
					<text v-for="(content,k) in list.actFormMsg" :key='k'>*{{content.name}}</text>
					<!-- <text>*联系电话</text>
					<text>*性别</text>
					<text>*年龄</text> -->
				</view>
			</view>
			<view class="add-form-click">
				<view class="add-course" @click="addForm">
					编辑添加新表单
				</view>
				<view class="add-form-tip">
					点击按钮，可以添加新的信息收集字段
				</view>
			</view>
		</view>
		<!-- 活动详情页 -->
		<view class="act-detail" style="margin-bottom: 120upx;">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					活动详情页
				</view>
			</view>
			<view class="act-detail-contain" v-if="list.activity_description.length!=0">
				<view class="" v-for="(item,index) in list.activity_description" :key='index'  >
					<view class="img-details" style="margin-bottom: 30upx;" v-if="item.type == 'photo' || item.description_type == '1'">
						<image class="img-content" :src="item.value" mode=""></image>
						<view class="masking"></view>
						<image class="delete-img" @click="delActImg(index)" :src="imglink + 'member/manage-active_icon_delete.png'" mode=""></image>
						<image class="rank-img" :src="imglink + 'member/rank.png'" mode="" @click="rankActDetail(item,index)"></image>
						<view class="change-img" @click="changeActImg(item,index)">
							更换图片
						</view>
					</view>
					<view class="text-details" style="margin-bottom: 30upx;" v-if="item.type == 'text' || item.description_type == '0'">
						<textarea :value="item.value" placeholder="请输入文字介绍" @input="gainValue($event,item)"/>
						<image class="delete-img" @click="delActText(index)" :src="imglink + 'member/manage-active_icon_delete.png'" mode=""></image>
						<image class="rank-img" @click="rankActDetail(item,index)" :src="imglink + 'member/rank.png'" mode=""></image>
					</view>
				</view>
			</view>
			<view class="add-img-text" style="margin-top: 38upx;">
				<view class="add-details" @click="addImage">
					<image :src="imglink + 'member/add-img.png'" mode=""></image>
					<text>添加图片</text>
				</view>
				<view class="add-details" @click="addActText">
					<image :src="imglink + 'member/add-text.png'" mode=""></image>
					<text>添加文字</text>
				</view>
			</view>
		</view>
		<!-- 预览暂存或者立刻发布活动 -->
		<view class="act-status">
			<view class="act-common" @click="previewAct">预览活动</view>
			<view class="act-common" @click="publishAct('0')">暂存活动</view>
			<view class="act-common publish" @click="publishAct('1')">立刻发布</view>
		</view>
		<!-- 发布成功弹框 -->
		<uni-popup ref="actPublish" :custom="true">
			<view class="popup_box_de">
				<view class="popup_box_succed-img">
					<image :src="imglink + 'member/pop_icon_success2.png'" mode=""></image>
				</view>
				<view class="popup_box-title-succed">
					恭喜你，活动发布成功！
				</view>
				<view class="popup_box-invite" @click="share">
					立即邀请本活动参与员工
				</view>
				 <!-- @click="inviteStaff" -->
			</view>
		</uni-popup>
		<!-- 活动暂存 -->
		<uni-popup ref="actStorage" :custom="true">
			<view class="popup_box_de" style="padding-top: 32upx;">
				<view class="popup_box_succed-img">
					<image :src="imglink + 'member/pop_icon_warning2.png'" mode=""></image>
				</view>
				<view class="popup_box-title-succed">
					活动已经暂存，请绑收款银行卡
				</view>
				<view class="popup_box-tip">
					请先绑定银行卡，否则将导致活动无法收款
				</view>
				<view class="popup_box-invite" style="margin-top: 38upx;" @click="bindingCard">
					立刻去绑卡
				</view>
				<view @click="bindingCardNo" class="popup_box-invite" style="margin-top: 38upx;background: #F3F3F4;color: #666666;box-shadow: none;">
					暂不绑卡
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
</script>

<style>
</style>
